﻿$(document).ready(function() {
    var loginIndexVm = new LoginIndexVm();
    ko.applyBindings(loginIndexVm, document.getElementById("body"));
});

var LoginIndexVm = function() {
    var self = this;
    BaseVm.call(self);

    self.Username = ko.observable("").extend({
        trimString: null,
        required: { message: "Required", params: true },
        maxLength: { message: "Must be 50 characters or fewer", params: 50 },
        pattern: { message: "Numeric and special characters are not allowed.", params: '^[a-zA-Z ]+$' },
        trackChange: true
    });
    
    self.Password = ko.observable("").extend({
        trimString: null,
        required: { message: "Required", params: true },
        maxLength: { message: "Must be 50 characters or fewer", params: 50 },
        trackChange: true 
    });

    self.Captcha = ko.observable("").extend({
        trimString: null,
        required: { message: "Required", params: true },
        trackChange: true
    });

    self.RememberMe = ko.observable(false);

    self.OnLogin = function() {
        alert("login");
    };

    self.OnCancel = function () {
        alert("here");
        window.location.href = "/Home/Index";
    };

    self.DirtyFlag = ko.dirtyFlag(self, false);
};

